
/*!--------------------------------*\
   3-Jekyll Theme
   @author Peiwen Lu (P233)
   https://github.com/P233/3-Jekyll
\*---------------------------------*/


// /*---------------------------------*\
//    Configs
// \*---------------------------------*/

//------- {{ colours }} -------//

$red:             #F8645A;
$green:           #2EB695;
$grey:            #7D8B99;
$black:           #020202;

$border:          #e5e8ec;

$tags-fg:         #A6A6A7;
$tags-hover-fg:   #F7F7F7;
$tags-active-fg:  $black;
$tags-bg:         #474D57;

$pl-bg:           #fafafa; // pl: posts-list

$pl-input-fg:     $green;
$pl-input-ph:     #cbcbcb; // input placeholder foreground colour
$pl-input-bg:     darken($pl-bg, 1%);

$pl-link-fg:      darken($grey, 10%);
$pl-hover-bg:     transparentize(darken($pl-bg, 3%), .5);
$pl-active-fg:    darken($green, 5%);

$post-fg:         #2C353D;
$post-bg:         #fff;
$post-link:       $grey;
$post-hover:      $green;

$img-bd:          $border;
$blockquote-bd:   $border;

$inline-code-bd:  $border;
$inline-code-fg:  #000;
$inline-code-bg:  #fafafa;

$selection-fg:    #fff;
$selection-bg:    lighten($green, 5%);

$flash:           $red;

$share-fg:        $grey;
$share-bd:        transparentize($border, .5);

$fs-fg:           $grey; // fs: fullscreen
$fs-hover:        $green;
$fs-bg:           transparentize($border, .5);

//------- {{ dimensions }} -------//

$tags-width:      165px;
$pl-width:        420px;
$sidebar-width:   $tags-width + $pl-width;

$search-height:   65px;

$fullscreen-width:800px;

//------- {{ nprogress-colour }} -------//

$nprogress:       $red;

//------- {{ pygments-colours }} -------//

$pygments-bd:        $border;
$pygments-odd:       rgba(69, 142, 209, 0.04);
$pygments-even:      #fdfdfd;

//------- {{ time-function }} -------//

$time-function:   cubic-bezier(0.770, 0.000, 0.175, 1.000);


/*---------------------------------*\
   Fonts
\*---------------------------------*/

@font-face {
  font-family: "fontello";
  src: url("../font/fontello.eot");
  src: url("../font/fontello.eot#iefix") format("embedded-opentype"),
       url("../font/fontello.woff") format("woff"),
       url("../font/fontello.ttf") format("truetype"),
       url("../font/fontello.svg#fontello") format("svg");
  font-weight: normal;
  font-style: normal;
}
.fontello {
  font-family: "fontello";
  speak: none;
  font-variant: normal;
  text-transform: none;
  // Better Font Rendering
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/*---------------------------------*\
   Base
\*---------------------------------*/

* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  font: 100 16px/1.5 Avenir, sans-serif;
  -webkit-font-smoothing: subpixel-antialiased;
  -webkit-text-size-adjust: none;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  -webkit-transition: color .35s;
  -moz-transition: color .35s;
  -ms-transition: color .35s;
  -o-transition: color .35s;
  transition: color .35s;
}


/*---------------------------------*\
   Sidebar => Tags & Posts List
\*---------------------------------*/

#sidebar {
  width: $sidebar-width;
  height: 100%;
  float: left;
  @media screen and (min-device-width: 1281px) {
    -webkit-transition: margin-left .5s $time-function;
    -moz-transition: margin-left .5s $time-function;
    -ms-transition: margin-left .5s $time-function;
    -o-transition: margin-left .5s $time-function;
    transition: margin-left .5s $time-function;
  }
  @media screen and (max-width: 1280px) {
    position: absolute;
    z-index: 97;
  }
  @media screen and (max-device-width: 1280px) {
    -webkit-transform: translateX(0);
    -moz-transform: translateX(0);
    -ms-transform: translateX(0);
    -o-transform: translateX(0);
    transform: translateX(0);
    -webkit-transition: -webkit-transform .5s $time-function;
    -moz-transition: -moz-transform .5s $time-function;
    -ms-transition: -ms-transform .5s $time-function;
    -o-transition: -o-transform .5s $time-function;
    transition: transform .5s $time-function;
  }
  @media screen and (max-width: $sidebar-width) {
    width: 100%;
  }
}


/*---------------------------------*\
   Tags
\*---------------------------------*/

#tags {
  width: $tags-width;
  height: 100%;
  background: $tags-bg;
  border-right: 1px solid darken($tags-bg, 5%);
  box-shadow: inset -15px 0 15px -15px #222;
  float: left;
  position: relative;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -o-user-select: none;
  user-select: none;
  @media screen and (max-width: $sidebar-width) {
    display: none;
  }
}

//------- {{ avatar }} -------//

#avatar {
  width: 100px;
  height: 100px;
  margin: 55px auto 35px;
  background: url(/assets/img/avatar.png);
  border-radius: 50%;
  box-shadow: 0 0 0px 4px white, 0 0 4px 4px #eee;
  overflow: hidden;
  display: block;
  &:hover {
    -webkit-animation: spin .35s linear infinite;
    -moz-animation: spin .35s linear infinite;
    -ms-animation: spin .35s linear infinite;
    -o-animation: spin .35s linear infinite;
    animation: spin .35s linear infinite;
  }
  @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    background: url(/assets/img/avatar@2X.png);
    -webkit-background-size: 100px 100px;
    -moz-background-size: 100px 100px;
    background-size: 100px 100px;
  }
}

//------- {{ tags__ul }} -------//

#tags__ul {
  margin: 0;
  padding: 0;
  font-size: 17px;
  border-top: 1px solid darken($tags-bg, 5%);
  border-bottom: 1px solid lighten($tags-bg, 5%);
  list-style: none;
}
.tags__li {
  padding: 12px 35px 9px;
  border-top: 1px solid lighten($tags-bg, 5%);
  border-bottom: 1px solid darken($tags-bg, 5%);
  cursor: pointer;
  &.active {
    margin-right: -1px;
    color: $tags-active-fg;
    background: $pl-bg;
    border-right: 1px solid $pl-bg;
    border-radius: 5px 0 0 5px;
    position: relative;
    -webkit-transition: none;
    -moz-transition: none;
    -ms-transition: none;
    -o-transition: none;
    transition: none;
    &:hover {
      color: $tags-active-fg;
      background: $pl-bg;
    }
    &:before, &:after {
      content: "";
      width: 6px;
      height: 6px;
      background: transparent;
      position: absolute;
      right: -3px;
    }
    &:before {
      top: -6px;
      border-right: 2px solid $pl-bg;
      border-bottom: 2px solid $pl-bg;
      border-radius: 0 0 6px 0;
    }
    &:after {
      bottom: -6px;
      border-right: 2px solid $pl-bg;
      border-top: 2px solid $pl-bg;
      border-radius: 0 6px 0 0;
    }
  }
}

//------- {{ tags__bottom }} -------//

#tags__bottom {
  width: 100%;
  height: 44px;
  border-top: 1px solid darken($tags-bg, 5%);
  overflow: hidden;
  position: absolute;
  left: 0;
  bottom: 0;
  > .fontello {
    width: 50%;
    font-size: 18px;
    line-height: 44px;
    text-align: center;
    border-top: 1px solid lighten($tags-bg, 5%);
    float: left;
  }
}
#icon-email {
  border-right: 1px solid darken($tags-bg, 5%);
  &:before {
    content: "\e800";
  }
}
#icon-feed {
  border-left: 1px solid lighten($tags-bg, 5%);
  &:before {
    content: "\e802";
  }
}

.tags-btn {
  color: $tags-fg;
  -webkit-transition: color .3s, background .3s;
  -moz-transition: color .3s, background .3s;
  -ms-transition: color .3s, background .3s;
  -o-transition: color .3s, background .3s;
  transition: color .3s, background .3s;
  &:hover {
    color: $tags-hover-fg;
    background: darken($tags-bg, 3%);
  }
}


/*---------------------------------*\
   Posts List
\*---------------------------------*/

#posts-list {
  width: $pl-width;
  height: 100%;
  background: transparentize($pl-bg, 0.05);
  border-right: 1px solid $border;
  float: left;
  position: relative;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -o-user-select: none;
  user-select: none;
  @media screen and (max-width: $sidebar-width) {
    width: 100%;
  }
}

//------- {{ search form }} -------//

#search-form {
  width: 100%;
  height: $search-height;
  border-bottom: 1px solid $border;
  @media screen and (max-width: $sidebar-width) {
    height: 51px;
    display: -webkit-flex;
    display: flex;
  }
}
#mobile-avatar {
  width: 50px;
  height: 50px;
  background: url(/assets/img/avatar.png);
  -webkit-background-size: 50px 50px;
  -moz-background-size: 50px 50px;
  background-size: 50px 50px;
  display: none;
  @media screen and (max-width: $sidebar-width) {
    display: block;
    float: left;
  }
}
#search-input {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 20px 20px 0;
  color: $pl-input-fg;
  font-size: 18px;
  font-family: inherit;
  background: $pl-input-bg;
  border: none;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  -ms-appearance: none;
  -o-appearance: none;
  appearance: none;
  cursor: not-allowed;
  &::-webkit-input-placeholder {
    color: $pl-input-ph;
    font-style: italic;
  }
  &::-moz-placeholder {
    color: $pl-input-ph;
    font-style: italic;
  }
  &:-ms-input-placeholder {
    color: $pl-input-ph;
    font-style: italic;
  }
  @media screen and (max-width: $sidebar-width) {
    padding: 10px 10px 0;
    -webkit-flex: 1;
    flex: 1;
  }
}

//------- {{ pl__container }} -------//

#pl__container {
  padding-top: 7px;
  padding-bottom: 10px;
  color: $pl-link-fg;
  text-shadow: -1px 1px 0 transparentize($grey, 0.9);
  overflow-x: hidden;
  overflow-y: auto;
  position: absolute;
  top: $search-height;
  bottom: 0;
  left: 0;
  right: -1px;
  -webkit-overflow-scrolling: touch;
  &::-webkit-scrollbar {
    width: 1px;
  }
  &::-webkit-scrollbar-thumb {
    background: transparent;
  }
  &:hover::-webkit-scrollbar-thumb {
    background: darken($border, 10%);
  }
  @media screen and (max-width: $sidebar-width) {
    font-size: 15px;
    top: 50px;
  }
}

//------- {{ pl__all }} -------//

.pl__all {
  margin: 4px 12px;
  padding: 4px 8px 3px;
  border-radius: 4px;
  display: block;
  &:hover {
    background: $pl-hover-bg;
  }
  &:visited > .pl__circle {
    background: $pl-bg;
  }
  &:visited:hover > .pl__circle {
    background: $pl-hover-bg;
  }
  &.active {
    color: $pl-active-fg;
    background: $pl-hover-bg;
    box-shadow: -1px 1px transparentize($border, 0.1);
    > .pl__circle {
      background: $pl-hover-bg;
      border-color: $pl-active-fg;
    }
  }
  @media screen and (max-width: $sidebar-width) {
    margin: 4px 0;
    border-radius: 0;
  }
}
.pl__circle {
  width: .75em;
  height: .75em;
  margin-right: 5px;
  background: lighten($pl-link-fg, 20%);
  border: 2px solid lighten($pl-link-fg, 20%);
  border-radius: 50%;
  display: inline-block;
  -webkit-transition: border-color .35s;
  -moz-transition: border-color .35s;
  -ms-transition: border-color .35s;
  -o-transition: border-color .35s;
  transition: border-color .35s;
}
.pl__date {
  color: lighten($pl-link-fg, 20%);
  font-size: 14px;
  float: right;
}

/*---------------------------------*\
   Post
\*---------------------------------*/

#post {
  height: 100%;
  color: $post-fg;
  font-size: 18px;
  line-height: 1.5;
  background: $post-bg;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  ::selection {
    color: $selection-fg;
    background:  $selection-bg;
    text-shadow: none;
  }
  ::-moz-selection {
    color: $selection-fg;
    background:  $selection-bg;
    text-shadow: none;
  }
  @media screen and (max-width: $sidebar-width) {
    font-size: 14px;
  }
}

#pjax {
  padding: 0 5% 30px;
  &.fadeIn {
    -webkit-animation: fadeIn .3s;
    -moz-animation: fadeIn .3s;
    -ms-animation: fadeIn .3s;
    -o-animation: fadeIn .3s;
    animation: fadeIn .3s;
  }
  &.fadeOut {
    -webkit-animation: fadeOut .2s;
    -moz-animation: fadeOut .2s;
    -ms-animation: fadeOut .2s;
    -o-animation: fadeOut .2s;
    animation: fadeOut .2s;
  }
  @media screen and (min-width: 1281px) {
    max-width: 100%;
  }
  @media screen and (max-width: 1280px) {
    max-width: $fullscreen-width;
    margin: 0 auto;
  }
}

//------- {{ post__content }} -------//

h1, h2, h3, h4, h5, h6 {
  font-weight: 400;
}

#post__title {
  margin: 0;
  padding-top: 1.1em;
  font-size: 2em;
}

#post__content {
  > p, > ul, > ol {
    margin-top: 1.5em;
    margin-bottom: 1.5em;
  }
  > ol > li {
    margin: .5em 0;
  }
  li > p {
    margin: 0;
  }
  a {
    color: $post-link;
    word-break: break-all;
    &:hover {
      // color: $post-hover;
      text-decoration: underline;
    }
  }
  img {
    max-width: 100%;
    max-height: 500px;
    border: 2px solid $img-bd;
    border-radius: 5px;
  }
}
strong {
  font-weight: 600;
}
blockquote {
  margin: 1.5em 0 1.5em 2em;
  padding-left: .5em;
  border-left: 5px solid $blockquote-bd;
}
kbd {
  padding: .2em .3em .1em;
  font-size: .75em;
  font-family: Consolas, Monaco, 'Andale Mono', monospace;
  background: white;
  background: -webkit-linear-gradient(left, #f6f4f4, white, #f6f4f4);
  background: -moz-linear-gradient(left, #f6f4f4, white, #f6f4f4);
  background: -ms-linear-gradient(left, #f6f4f4, white, #f6f4f4);
  background: -o-linear-gradient(left, #f6f4f4, white, #f6f4f4);
  background: linear-gradient(left, #f6f4f4, white, #f6f4f4);
  border-color: #fbfaf9 #f0eeed #e1dfdf;
  border-width: .25em .3em .4em;
  border-style: solid;
  border-radius: .25em;
  vertical-align: .3em;
}
iframe {
  margin-top: 1.5em;
  @media screen and (max-width: $sidebar-width) {
    height: 260px;
  }
}


//------- {{ post__toc }} -------//

#post__toc-trigger {
  width: 300px;
  padding-left: 40px;
  position: fixed;
  top: $search-height - 1;
  bottom: 0;
  right: 0;
  z-index: 98;
  -webkit-transform: translateX(260px);
  -moz-transform: translateX(260px);
  -ms-transform: translateX(260px);
  -o-transform: translateX(260px);
  transform: translateX(260px);
  -webkit-transition: -webkit-transform .35s ease-in-out .1s;
  -moz-transition: -moz-transform .35s ease-in-out .1s;
  -ms-transition: -ms-transform .35s ease-in-out .1s;
  -o-transition: -o-transform .35s ease-in-out .1s;
  transition: transform .35s ease-in-out .1s;
  &:hover {
    -webkit-transform: translateX(0);
    -moz-transform: translateX(0);
    -ms-transform: translateX(0);
    -o-transform: translateX(0);
    transform: translateX(0);
  }
  @media screen and (max-device-width: 1280px) {
    display: none;
  }
}
#post__toc {
  width: 260px;
  height: 100%;
  padding-top: 30px;
  background: transparentize($pl-bg, 0.1);
  border-top: 1px solid $border;
  border-left: 1px solid $border;
  border-radius: 10px 0 0 0;
  display: block;
  overflow-y: scroll;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -o-user-select: none;
  user-select: none;
}

#post__toc-title {
  padding: 0 0 5px 11px;
  color: $post-fg;
  font-size: 1em;
  display: block;
}

#post__toc-ul {
  margin: 0;
  padding: 0 10px 20px 15px;
  line-height: 1.6;
}
.post__toc-li {
  color: $post-link;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: block;
  overflow: hidden;
  &:before {
    content: "\e806";
    @extend .fontello;
    margin-right: 5px;
  }
  > a:hover {
    color: $post-hover;
  }
}
.post__toc-h1 {
  font-size: 1em;
  list-style: none;
}
.post__toc-h2 {
  font-size: .95em;
}
.post__toc-h3 {
  margin-left: 12px;
  font-size: .9em;
  & + .post__toc-h2 {
    padding-top: .25em;
  }
}

// smooth scolling flash effects
.flash {
  -webkit-animation: flash .6s;
  -moz-animation: flash .6s;
  -ms-animation: flash .6s;
  -o-animation: flash .6s;
  animation: flash .6s;
}

//------- {{ post__share }} -------//

#post__share {
  height: 21px;
  margin-top: 2.5em;
  margin-bottom: 19px;
  border-bottom: 2px solid $share-bd;
  position: relative;
  > .fontello {
    display: block;
    width: 40px;
    height: 40px;
    color: $share-fg;
    font-size: 20px;
    text-align: center;
    line-height: 36px;
    background: $post-bg;
    border: 2px solid $share-bd;
    box-shadow: 0 0 7px 7px transparent;
    border-radius: 50%;
    position: absolute;
    left: 50%;
    -webkit-transition: color .35s, box-shadow .35s;
    -moz-transition: color .35s, box-shadow .35s;
    -ms-transition: color .35s, box-shadow .35s;
    -o-transition: color .35s, box-shadow .35s;
    transition: color .35s, box-shadow .35s;
    &:hover {
      box-shadow: 0 0 0 2px transparentize($grey, .85);
    }
  }
}
#icon-twitter {
  margin-left: -90px;
  &:hover {
    color: #4099ff;
  }
  &:before {
    content: "\e805";
  }
}
#icon-cc {
  margin-left: -20px;
  &:hover {
    color: #f8ce5e;
  }
  &:before {
    content: "\e803";
  }
}
#icon-weibo {
  margin-left: 50px;
  &:hover {
    color: #d40220;
  }
  &:before {
    content: "\e804";
  }
}

//------- {{ disqus_thread }} -------//

#disqus_thread {
  padding: 30px 0;
  -webkit-box-sizing: content-box;
  -moz-box-sizing: content-box;
  box-sizing: content-box;
}

//------- {{ copyright }} -------//

#copyright {
  margin: 0;
  padding-top: 1em;
  font-size: .9em;
  text-align: center;
  border-top: 2px solid $share-bd;
  > a {
    color: $green;
    &:hover {
      text-decoration: underline;
    }
  }
}

/*---------------------------------*\
   Fullscreen Style
\*---------------------------------*/

#sidebar.fullscreen {
  @media screen and (min-device-width: 1281px) {
    margin-left: -$sidebar-width;
  }
  @media screen and (max-device-width: 1280px) {
    -webkit-transform: translateX(-$sidebar-width);
    -moz-transform: translateX(-$sidebar-width);
    -ms-transform: translateX(-$sidebar-width);
    -o-transform: translateX(-$sidebar-width);
    transform: translateX(-$sidebar-width);
  }
}

#pjax.fullscreen {
  max-width: $fullscreen-width;
  margin: 0 auto;
}

%fixed-btn-size {
  width: 40px;
  height: 40px;
}
%fixed-btn-positon {
  top: 12px;
  right: 20px;
}

//------- {{ js__fullscreen }} -------//

#js-fullscreen {
  @extend %fixed-btn-size;
  margin: 0;
  padding: 0;
  color: $fs-fg;
  background: $fs-bg;
  border-radius: 50%;
  border: none;
  box-shadow: 0 0 10px 10px transparent;
  outline: none;
  cursor: pointer;
  position: fixed;
  -webkit-transition: box-shadow .35s;
  -moz-transition: box-shadow .35s;
  -ms-transition: box-shadow .35s;
  -o-transition: box-shadow .35s;
  transition: box-shadow .35s;
  &:hover {
    color: $fs-hover;
    box-shadow: 0 0 0 3px transparentize($grey, .85);
  }
  @extend %fixed-btn-positon;
  z-index: 99;
  -webkit-appearance: none;
  -moz-appearance: none;
  -ms-appearance: none;
  -o-appearance: none;
  appearance: none;
  @media screen and (max-width: $sidebar-width) {
    width: 50px;
    height: 50px;
    top: 0;
    right: 0;
    border-radius: 0;
  }
}
#icon-arrow {
  padding: 10px;
  -webkit-transform: rotate(0deg);
  -moz-transform: rotate(0deg);
  -ms-transform: rotate(0deg);
  -o-transform: rotate(0deg);
  transform: rotate(0deg);
  -webkit-transition: -webkit-transform .5s $time-function;
  -moz-transition: -moz-transform .5s $time-function;
  -ms-transition: -ms-transform .5s $time-function;
  -o-transition: -o-transform .5s $time-function;
  transition: transform .5s $time-function;
  display: block;
  &:before {
    content: "\e801";
    margin-left: -1px;
    font-size: 20px;
    line-height: 1;
  }
  &.fullscreen {
    -webkit-transform: rotate(180deg);
    -moz-transform: rotate(180deg);
    -ms-transform: rotate(180deg);
    -o-transform: rotate(180deg);
    transform: rotate(180deg);
  }
  @media screen and (max-width: $sidebar-width) {
    padding: 15px;
  }
}


/*---------------------------------*\
   Vendors
\*---------------------------------*/

@import "animation";
@import "nprogress";
@import "pygments";
